package com.taobao.top.api;

import java.util.TreeMap;

import com.taobao.top.api.exception.ApiException;
import com.taobao.top.beans.AppConstants;
import com.taobao.top.utils.APIUtil;

public class Wuliu_API {
	public String getAreas(String format,String mFields) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.areas.get");
		apiparamsMap.put("fields", mFields);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	public String addTemplateDelivery(String format,String mName,String mAssumer,String mValuation,String mTemplate_types,String mTemplate_dests,String mTemplate_start_standards,
			String mTemplate_start_fees,String mTemplate_add_standards,String mTemplate_add_fees) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.delivery.template.add");
		/* 需要获取的字段 */
		apiparamsMap.put("name", mName);
		apiparamsMap.put("assumer", mAssumer);
		apiparamsMap.put("valuation", mValuation);
		apiparamsMap.put("template_types", mTemplate_types);
		apiparamsMap.put("template_dests", mTemplate_dests);
		apiparamsMap.put("template_start_standards", mTemplate_start_standards);
		apiparamsMap.put("template_start_fees", mTemplate_start_fees);
		apiparamsMap.put("template_add_standards", mTemplate_add_standards);
		apiparamsMap.put("template_add_fees", mTemplate_add_fees);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	public String deleteTemplateDelivery(String format,String mTemplate_id) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.delivery.template.delete");
		apiparamsMap.put("template_id", mTemplate_id);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	public String getTemplateDelivery(String format,String mTemplate_ids,String mFields) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.delivery.template.get");
		apiparamsMap.put("template_ids", mTemplate_ids);
		apiparamsMap.put("fields", mFields);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	public String updateTemplatDelivery(String format,String name,String mTemplate_id,String assumer,
			String mTemplate_types) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.delivery.template.update");
		if(name!=null||name.trim().equals("")){
			apiparamsMap.put("name", name);
		}
		apiparamsMap.put("template_id", mTemplate_id);
		if(assumer!=null||assumer.trim().equals("")){
			apiparamsMap.put("assumer", assumer);
		}
		apiparamsMap.put("template_types", mTemplate_types);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	public String getTemplatesDelivery(String format,String mFields) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.delivery.templates.get");
		apiparamsMap.put("fields", mFields);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	public String addAddressLogistics(String format,String mContact_name,String mProvince,
			String mCity,String country,String mAddr,String zip_code,String aPhone,
			String aMobile_phone,String seller_company,String memo,String get_def,String cancel_def){
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.address.add");
		apiparamsMap.put("contact_name", mContact_name);
		apiparamsMap.put("province", mProvince);
		apiparamsMap.put("city", mCity);
		if(country!=null||country.trim().equals("")){
			apiparamsMap.put("country", country);
		}
		apiparamsMap.put("addr", mAddr);
		if(zip_code!=null||zip_code.trim().equals("")){
			apiparamsMap.put("zip_code", zip_code);
		}
		if(aPhone!=null||aPhone.trim().equals("")){
			apiparamsMap.put("phone", aPhone);
		}
		if(aMobile_phone!=null||aMobile_phone.trim().equals("")){
			apiparamsMap.put("mobile_phone", aMobile_phone);
		}
		if(seller_company!=null||seller_company.trim().equals("")){
			apiparamsMap.put("seller_company", seller_company);
		}
		if(memo!=null||memo.trim().equals("")){
			apiparamsMap.put("memo", memo);
		}
		if(get_def!=null||get_def.trim().equals("")){
			apiparamsMap.put("get_def", get_def);
		}
		if(cancel_def!=null||cancel_def.trim().equals("")){
			apiparamsMap.put("cancel_def", cancel_def);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	public String modifyAddressLogistics(String format,String mContact_id,String mContact_name,
			String mProvince,String mCity,String country,String mAddr,
			String zip_code,String aPhone,String aMobile_phone,String seller_company,
			String memo,String get_def,String cancel_def) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.address.modify");
		apiparamsMap.put("contact_id", mContact_id);
		apiparamsMap.put("contact_name", mContact_name);
		apiparamsMap.put("province", mProvince);
		apiparamsMap.put("city", mCity);
		if(country!=null||country.trim().equals("")){
		apiparamsMap.put("country", country);
		}
		apiparamsMap.put("addr", mAddr);
		if(zip_code!=null||zip_code.trim().equals("")){
			apiparamsMap.put("zip_code", zip_code);
		}
		if(aPhone!=null||aPhone.trim().equals("")){
			apiparamsMap.put("phone", aPhone);
		}
		if(aMobile_phone!=null||aMobile_phone.trim().equals("")){
			apiparamsMap.put("mobile_phone", aMobile_phone);
		}
		if(seller_company!=null||seller_company.trim().equals("")){
			apiparamsMap.put("seller_company", seller_company);
		}
		if(memo!=null||memo.trim().equals("")){
			apiparamsMap.put("memo", memo);
		}
		if(get_def!=null||get_def.trim().equals("")){
		apiparamsMap.put("get_def", get_def);
		}
		if(cancel_def!=null||cancel_def.trim().equals("")){
			apiparamsMap.put("cancel_def", cancel_def);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	public String removeAddressLogistics(String format,String mContact_id){
		//taobao.logistics.address.remove
		return null;
	}
	//taobao.logistics.address.search
	public String searchAddressLogistics(String format,String rdef) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.address.search");
		if(rdef!=null||rdef.trim().equals("")){
		apiparamsMap.put("rdef", rdef);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	//taobao.logistics.companies.get
	public String getCompaniesLogistics(String format,String mFields,
			String is_recommended,String order_mode) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.companies.get");
		apiparamsMap.put("fields", mFields);
		if(is_recommended!=null||is_recommended.trim().equals("")){
		apiparamsMap.put("is_recommended", is_recommended);
		}
		if(order_mode!=null||order_mode.trim().equals("")){
		apiparamsMap.put("order_mode", order_mode);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	//taobao.logistics.dummy.send
	public String sendDummyLogistics(String format,String mTid,String feature){
		return null;
	}
	//taobao.logistics.offline.send
	public String sendOfflineLogistics(String format,String mTid,String mOut_sid,
			String mCompany_code,String sender_id,String cancel_id,String feature) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.offline.send");
		apiparamsMap.put("tid", mTid);
		apiparamsMap.put("out_sid", mOut_sid);
		apiparamsMap.put("company_code", mCompany_code);
		if(sender_id!=null||sender_id.trim().equals("")){
		apiparamsMap.put("sender_id", sender_id);
		}
		if(cancel_id!=null||cancel_id.trim().equals("")){
		apiparamsMap.put("cancel_id", cancel_id);
		}
		if(feature!=null||feature.trim().equals("")){
		apiparamsMap.put("feature", feature);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.logistics.online.cancel
	public String cancelOnlineLogistics(String format,String mTid) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.online.cancel");
		apiparamsMap.put("tid", mTid);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	//taobao.logistics.online.confirm
	public String confirmOnlineLogistics(String format,String mTid,String mOut_sid) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.online.confirm");
		apiparamsMap.put("tid", mTid);
		apiparamsMap.put("out_sid", mOut_sid);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	//taobao.logistics.online.send
	public String sendOnlineLogistics(String format,String mTid,String out_sid,
			String mCompany_code,String sender_id,String cancel_id,String feature) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.online.send");
		apiparamsMap.put("tid", mTid);
		if(out_sid!=null||out_sid.trim().equals("")){
		apiparamsMap.put("out_sid", out_sid);
		}
		apiparamsMap.put("company_code", mCompany_code);
		if(sender_id!=null||sender_id.trim().equals("")){
		apiparamsMap.put("sender_id", sender_id);
		}
		if(cancel_id!=null||cancel_id.trim().equals("")){
		apiparamsMap.put("cancel_id", cancel_id);
	    }
		if(feature!=null||feature.trim().equals("")){
			apiparamsMap.put("feature", feature);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.logistics.orders.detail.get
	public String getDetailLogistics(String format,String mFields,String tid,
			String buyer_nick,String status,String seller_confirm,
			String start_created,String end_created,String freight_payer,
			String type,String page_no,String page_size) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.orders.detail.get");
		apiparamsMap.put("fields", mFields);
		if(tid!=null||tid.trim().equals("")){
		apiparamsMap.put("tid", tid);
		}
		if(buyer_nick!=null||buyer_nick.trim().equals("")){
		apiparamsMap.put("buyer_nick", buyer_nick);
		}
		if(status!=null||status.trim().equals("")){
		apiparamsMap.put("status", status);
		}
		if(seller_confirm!=null||seller_confirm.equals("")){
		apiparamsMap.put("seller_confirm", seller_confirm);
		}
		if(start_created!=null||start_created.trim().equals("")){
		apiparamsMap.put("start_created", start_created);
		}
		if(end_created!=null||end_created.trim().equals("")){
		apiparamsMap.put("end_created", end_created);
		}
		if(freight_payer!=null||freight_payer.trim().equals("")){
		apiparamsMap.put("freight_payer", freight_payer);
		}
		if(type!=null||type.trim().equals("")){
		apiparamsMap.put("type", type);
		}
		if(page_no!=null||page_no.trim().equals("")){
		apiparamsMap.put("page_no", page_no);
		}
		if(page_size!=null||page_size.trim().equals("")){
		apiparamsMap.put("page_size", page_size);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.logistics.orders.get
	public String getOrdersLogistics(String format,String mFields,String tid,String buyer_nick,
			String status,String seller_confirm,String receiver_name,String start_created,
			String end_created,String freight_payer,String type,String page_no,String page_size) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "logistics.orders.get");
		apiparamsMap.put("fields", mFields);
		if(tid!=null||tid.trim().equals("")){
		apiparamsMap.put("tid", tid);
		}
		if(buyer_nick!=null||buyer_nick.trim().equals("")){
		apiparamsMap.put("buyer_nick", buyer_nick);
		}
		if(status!=null||status.trim().equals("")){
		apiparamsMap.put("status", status);
		}
		if(seller_confirm!=null||seller_confirm.trim().equals("")){
		apiparamsMap.put("seller_confirm", seller_confirm);
		}
		if(receiver_name!=null||receiver_name.trim().equals("")){
		apiparamsMap.put("receiver_name", receiver_name);
		}
		if(start_created!=null||start_created.trim().equals("")){
		apiparamsMap.put("start_created", start_created);
		}
		if(end_created!=null||end_created.trim().equals("")){
		apiparamsMap.put("end_created", end_created);
		}
		if(freight_payer!=null||freight_payer.trim().equals("")){
		apiparamsMap.put("freight_payer", freight_payer);
		}
		if(type!=null||type.trim().equals("")){
		apiparamsMap.put("type", type);
		}
		if(page_no!=null||page_no.trim().equals("")){
		apiparamsMap.put("page_no", page_no);
		}
		if(page_size!=null||page_size.trim().equals("")){
		apiparamsMap.put("page_size", page_size);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.logistics.partners.get
	public String getPartnersLogistics(String format,String mService_type,String source_id,
			String target_id,String goods_value) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.partners.get");
		apiparamsMap.put("service_type", mService_type);
		if(source_id!=null||source_id.trim().equals("")){
		apiparamsMap.put("source_id", source_id);
		}
		if(target_id!=null||target_id.trim().equals("")){
		apiparamsMap.put("target_id", target_id);
		}
		if(goods_value!=null||goods_value.trim().equals("")){
		apiparamsMap.put("goods_value", goods_value);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.logistics.trace.search
	public String searchTraceLogistics(String format,String mTid,String mSeller_nick) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.logistics.trace.search");
		apiparamsMap.put("tid", mTid);
		apiparamsMap.put("seller_nick", mSeller_nick);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.postage.add
	public String addPostage(String format,String mName,String aPost_price,String aExpress_price,
			String aExpress_increase,String aEms_price,String aEms_increase,String memo,
			String postage_mode_types,String postage_mode_dests,String postage_mode_prices,String postage_mode_increases) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.postage.add");
		apiparamsMap.put("name", mName);
		if(aPost_price!=null||aPost_price.trim().equals("")){
		apiparamsMap.put("post_price", aPost_price);
		}
		if(aExpress_price!=null||aExpress_price.trim().equals("")){
		apiparamsMap.put("express_price", aExpress_price);
		}
		if(aExpress_increase!=null||aExpress_increase.trim().equals("")){
		apiparamsMap.put("express_increase", aExpress_increase);
		}
		if(aEms_price!=null||aEms_price.trim().equals("")){
		apiparamsMap.put("ems_price", aEms_price);
		}
		if(aEms_increase!=null||aEms_increase.trim().equals("")){
		apiparamsMap.put("ems_increase", aEms_increase);
		}
		if(memo!=null||memo.trim().equals("")){
		apiparamsMap.put("memo", memo);
		}
		if(postage_mode_types!=null||postage_mode_types.trim().equals("")){
		apiparamsMap.put("postage_mode_types", postage_mode_types);
		}
		if(postage_mode_dests!=null||postage_mode_dests.trim().equals("")){
		apiparamsMap.put("postage_mode_dests", postage_mode_dests);
		}
		if(postage_mode_prices!=null||postage_mode_prices.trim().equals("")){
		apiparamsMap.put("postage_mode_prices", postage_mode_prices);
		}
		if(postage_mode_increases!=null||postage_mode_increases.trim().equals("")){
		apiparamsMap.put("postage_mode_increases", postage_mode_increases);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.postage.delete
	public String deletePostage(String format,String mPostage_id) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.postage.delete");
		apiparamsMap.put("postage_id", mPostage_id);
		
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.postage.get
	public String getPostage(String format,String mFields,String mPostage_id,String mNick) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.postage.get");
		apiparamsMap.put("fields", mFields);
		apiparamsMap.put("postage_id", mPostage_id);
		apiparamsMap.put("nick", mNick);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
		
	}
	//taobao.postage.update
	public String updatePostage(String format,String mPostage_id,String aPost_price,
			String aPost_increase,String aExpress_price,String aExpress_increase,
			String aEms_price,String aEms_increase,String name,String memo,
			String postage_mode_ids,String postage_mode_types,String postage_mode_dests,
			String postage_mode_prices,String postage_mode_increases,String postage_mode_optTypes,
			String remove_post,String remove_express,String remove_ems) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.postage.update");
		apiparamsMap.put("postage_id", mPostage_id);
		if(aPost_price!=null||aPost_price.trim().equals("")){
		apiparamsMap.put("post_price", aPost_price);
		}
		if(aPost_increase!=null||aPost_increase.trim().equals("")){
		apiparamsMap.put("post_increase", aPost_increase);
		}
		if(aExpress_price!=null||aExpress_price.trim().equals("")){
		apiparamsMap.put("express_price", aExpress_price);
		}
		if(aExpress_increase!=null||aExpress_increase.trim().equals("")){
		apiparamsMap.put("express_increase", aExpress_increase);
		}
		if(aEms_price!=null||aEms_price.trim().equals("")){
		apiparamsMap.put("ems_price", aEms_price);
		}
		if(aEms_increase!=null||aEms_increase.trim().equals("")){
		apiparamsMap.put("ems_increase", aEms_increase);
		}
		if(name!=null||name.trim().equals("")){
		apiparamsMap.put("name", name);
		}
		if(memo!=null||memo.trim().equals("")){
		apiparamsMap.put("memo", memo);
		}
		if(postage_mode_ids!=null||postage_mode_ids.trim().equals("")){
		apiparamsMap.put("postage_mode_ids", postage_mode_ids);
		}
		if(postage_mode_types!=null||postage_mode_types.trim().equals("")){
		apiparamsMap.put("postage_mode_types", postage_mode_types);
		}
		if(postage_mode_dests!=null||postage_mode_dests.trim().equals("")){
		apiparamsMap.put("postage_mode_dests", postage_mode_dests);
		}
		if(postage_mode_prices!=null||postage_mode_prices.trim().equals("")){
		apiparamsMap.put("postage_mode_prices", postage_mode_prices);
		}
		if(postage_mode_increases.trim().equals("")){
		apiparamsMap.put("postage_mode_increases", postage_mode_increases);
		}
		if(postage_mode_optTypes!=null||postage_mode_optTypes.trim().equals("")){
		apiparamsMap.put("postage_mode_optTypes", postage_mode_optTypes);
		}
		if(remove_post!=null||remove_post.trim().equals("")){
		apiparamsMap.put("remove_post", remove_post);
		}
		if(remove_express!=null||remove_express.trim().equals("")){
		apiparamsMap.put("remove_express", remove_express);
		}
		if(remove_ems!=null||remove_ems.trim().equals("")){
		apiparamsMap.put("remove_ems", remove_ems);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	//taobao.postages.get
	public String getPostages(String format,String mFields) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.postages.get");
		apiparamsMap.put("fields", mFields);
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
	//taobao.topats.delivery.send
	public String sendDeliveryTopats(String format,String mTids,String company_codes,
			String out_sids,String seller_name,String seller_area_id,String seller_address,
			String seller_zip,String seller_phone,String seller_mobile,String order_types,
			String memos) throws ApiException{
		TreeMap<String, String> apiparamsMap=new TreeMap<String, String>();
		/* 添加除方法名和签名之外的系统级参数 */
		apiparamsMap.putAll(APIUtil.getSystemParams());
		/* 用户需要自定义返回的格式，默认为XML */
		if(format!=null||format.trim().equals("")){
			apiparamsMap.put("format", format);
		}
		/* API方法名 */
		apiparamsMap.put("method", "taobao.topats.delivery.send");
		apiparamsMap.put("tids", mTids);
		if(company_codes!=null||company_codes.trim().equals("")){
		apiparamsMap.put("company_codes", company_codes);
		}
		if(out_sids!=null||out_sids.trim().equals("")){
		apiparamsMap.put("out_sids", out_sids);
		}
		if(seller_name!=null||seller_name.trim().equals("")){
		apiparamsMap.put("seller_name", seller_name);
		}
		if(seller_area_id!=null||seller_area_id.trim().equals("")){
		apiparamsMap.put("seller_area_id", seller_area_id);
		}
		if(seller_address!=null||seller_address.trim().equals("")){
		apiparamsMap.put("seller_address", seller_address);
		}
		if(seller_zip!=null||seller_zip.trim().equals("")){
		apiparamsMap.put("seller_zip", seller_zip);
		}
		if(seller_phone!=null||seller_phone.trim().equals("")){
		apiparamsMap.put("seller_phone", seller_phone);
		}
		if(seller_mobile!=null||seller_mobile.trim().equals("")){
		apiparamsMap.put("seller_mobile", seller_mobile);
		}
		if(order_types!=null||order_types.trim().equals("")){
		apiparamsMap.put("order_types", order_types);
		}
		if(memos!=null||memos.trim().equals("")){
		apiparamsMap.put("memos", memos);
		}
		/* 生成签名 */
		String sign=APIUtil.md5Signature(apiparamsMap, AppConstants.SECRET);
		apiparamsMap.put("sign", sign);
		String paramsString=APIUtil.getContent(apiparamsMap);
		String responseData=APIUtil.getResult(AppConstants.APIURL, paramsString);
		return responseData;
	}
}
